// server/app/router/procurement_route.js
'use strict';

module.exports = app => {
  const { router, controller } = app;
  
  // 进货入库相关路由
  router.get('/api/v1/procurement/inbound-orders/stats', controller.procurement.inboundOrderController.stats);
  router.get('/api/v1/procurement/inbound-orders', controller.procurement.inboundOrderController.index);
  router.get('/api/v1/procurement/inbound-orders/:id', controller.procurement.inboundOrderController.show);
  router.post('/api/v1/procurement/inbound-orders', controller.procurement.inboundOrderController.create);
  router.put('/api/v1/procurement/inbound-orders/:id', controller.procurement.inboundOrderController.update);
  router.delete('/api/v1/procurement/inbound-orders/:id', controller.procurement.inboundOrderController.destroy);
  
  // 供应商相关路由
  router.get('/api/v1/procurement/suppliers', controller.procurement.supplierController.index);
  router.get('/api/v1/procurement/suppliers/stats', controller.procurement.supplierController.stats);
  router.get('/api/v1/procurement/suppliers/:id', controller.procurement.supplierController.show);
  router.post('/api/v1/procurement/suppliers', controller.procurement.supplierController.create);
  router.put('/api/v1/procurement/suppliers/:id', controller.procurement.supplierController.update);
  router.delete('/api/v1/procurement/suppliers/:id', controller.procurement.supplierController.destroy);
  router.post('/api/v1/procurement/suppliers/batch-delete', controller.procurement.supplierController.batchDelete);
  router.post('/api/v1/procurement/suppliers/batch-activate', controller.procurement.supplierController.batchActivate);
  router.post('/api/v1/procurement/suppliers/batch-deactivate', controller.procurement.supplierController.batchDeactivate);
  router.get('/api/v1/procurement/suppliers/export', controller.procurement.supplierController.exportSuppliers);
  router.get('/api/v1/procurement/suppliers/export-template', controller.procurement.supplierController.exportTemplate);
  router.post('/api/v1/procurement/suppliers/import', controller.procurement.supplierController.importSuppliers);
  
  // 合同管理相关路由
  router.get('/api/v1/procurement/contracts', controller.procurement.contractController.index);
  router.get('/api/v1/procurement/contracts/:id', controller.procurement.contractController.show);
  router.post('/api/v1/procurement/contracts', controller.procurement.contractController.create);
  router.put('/api/v1/procurement/contracts/:id', controller.procurement.contractController.update);
  router.delete('/api/v1/procurement/contracts/:id', controller.procurement.contractController.destroy);
  
  // 供应商评估相关路由
  router.get('/api/v1/procurement/evaluations', controller.procurement.supplierEvaluationController.index);
  router.get('/api/v1/procurement/evaluations/:id', controller.procurement.supplierEvaluationController.show);
  router.post('/api/v1/procurement/evaluations', controller.procurement.supplierEvaluationController.create);
  router.put('/api/v1/procurement/evaluations/:id', controller.procurement.supplierEvaluationController.update);
  router.delete('/api/v1/procurement/evaluations/:id', controller.procurement.supplierEvaluationController.destroy);
  router.get('/api/v1/procurement/evaluations/stats', controller.procurement.supplierEvaluationController.getSupplierStats);
  
  // 导入导出相关路由
  router.get('/api/v1/procurement/inbound-orders/export', controller.procurement.inboundOrderController.export);
  router.get('/api/v1/procurement/inbound-orders/export-template', controller.procurement.inboundOrderController.exportTemplate);
  router.post('/api/v1/procurement/inbound-orders/import', controller.procurement.inboundOrderController.import);
  
  // 采购订单相关路由
  router.get('/api/v1/procurement/purchase-orders', controller.procurement.purchaseOrderController.index);
  router.get('/api/v1/procurement/purchase-orders/:id', controller.procurement.purchaseOrderController.show);
  router.post('/api/v1/procurement/purchase-orders', controller.procurement.purchaseOrderController.create);
  router.put('/api/v1/procurement/purchase-orders/:id', controller.procurement.purchaseOrderController.update);
  router.delete('/api/v1/procurement/purchase-orders/:id', controller.procurement.purchaseOrderController.destroy);
  router.get('/api/v1/procurement/purchase-orders/stats', controller.procurement.purchaseOrderController.stats);
};